package com.crm.business.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.crm.business.crm.service.BillCrmOrderPoolService;
import com.crm.common.crm.entity.BO.BillOrderPoolBO;
import com.crm.common.crm.entity.BO.CrmSearchBO;
import com.crm.common.crm.entity.PO.BillCrmOrderPool;
import com.crm.common.ka.core.common.R;
import com.crm.common.ka.core.common.Result;
import com.crm.common.ka.core.common.log.BehaviorEnum;
import com.crm.common.ka.core.common.log.SysLogHandler;
import com.crm.common.ka.core.entity.BasePage;
import com.github.pagehelper.Page;

import org.bouncycastle.cert.ocsp.Req;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/adminOrderPool")
@Api(tags = "账单池")
@Slf4j
public class BillAdminOrderPoolController {

    @Autowired
    private BillCrmOrderPoolService billCrmOrderPoolService;

    @PostMapping("/queryPageList")
    @ApiOperation("查询列表页数据")
    public Result<IPage<BillCrmOrderPool>> queryPageList(@RequestBody  BillOrderPoolBO billOrderPoolBO) {
        IPage<BillCrmOrderPool> poolPage = billCrmOrderPoolService.queryPageList(billOrderPoolBO);
        return R.ok(poolPage);
    }

    @GetMapping("/queryById/{id}")
    @ApiOperation("查询详细")
    public Result<BillCrmOrderPool> queryById(@PathVariable("id") Integer id){
        return  billCrmOrderPoolService.queryById(id);
    }


    @PostMapping("/update")
    @ApiOperation("更新数据")
    @SysLogHandler(behavior = BehaviorEnum.UPDATE)
    public Result<Map<String, Object>> update(@RequestBody BillCrmOrderPool billCrmOrderPool){
        return  billCrmOrderPoolService.update(billCrmOrderPool);
    }


}
